package com.nbsaas.boot.data.rest.resource;

import com.nbsaas.boot.data.api.apis.QueryMacroApi;
import com.nbsaas.boot.data.data.entity.QueryMacro;
import com.nbsaas.boot.data.api.domain.request.QueryMacroRequest;
import com.nbsaas.boot.data.api.domain.response.QueryMacroResponse;
import com.nbsaas.boot.data.api.domain.simple.QueryMacroSimple;
import com.nbsaas.boot.data.rest.convert.QueryMacroSimpleConvert;
import com.nbsaas.boot.data.rest.convert.QueryMacroEntityConvert;
import com.nbsaas.boot.data.rest.convert.QueryMacroResponseConvert;
import com.nbsaas.boot.data.data.repository.QueryMacroRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   -业务接口实现
*/
@Transactional
@Service
public class QueryMacroResource extends BaseResource<QueryMacro,QueryMacroResponse, QueryMacroSimple, QueryMacroRequest>  implements QueryMacroApi {

    @Resource
    private QueryMacroRepository queryMacroRepository;

    @Override
    public JpaRepositoryImplementation<QueryMacro, Serializable> getJpaRepository() {
        return queryMacroRepository;
    }

    @Override
    public Function<QueryMacro, QueryMacroSimple> getConvertSimple() {
        return new QueryMacroSimpleConvert();
    }

    @Override
    public Function<QueryMacroRequest, QueryMacro> getConvertForm() {
        return new QueryMacroEntityConvert();
    }

    @Override
    public Function<QueryMacro, QueryMacroResponse> getConvertResponse() {
        return new QueryMacroResponseConvert();
    }




}


